library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity taxi-ledover is
PORT(
sys_clk : IN STD_LOGIC;--50M系统时钟输入
rst_cus : IN STD_LOGIC;--上客信号输入
rst_rid : IN STD_LOGIC;--行驶信号输入
LEDrun,LEDwait : OUT STD_LOGIC);--LED灯闪动信号输出
END taxi-ledover;
ARCHITECTURE Behavioral OF taxi-ledover IS

SIGNAL led_delay : STD_LOGIC_VECTOR(2 DOWNTO 0);--延时计数器，对50M时钟分频
SIGNAL flag1,flag2 : STD_LOGIC;--亮灯标识
BEGIN
PROCESS(sys_clk,rst_cus,rst_rid)
BEGIN
IF rst_cus = '0' THEN--复位，对led_delay请零
led_delay <= (OTHERS => '0');
ELSIF sys_clk'EVENT AND sys_clk = '1' THEN--时钟上升沿，led_delay加一
		led_delay <= led_delay + '1';--行驶中
	IF rst_rid = '1' THEN
		flag1<=led_delay(1);
		flag2<='0';
	ELSE
		flag2<=led_delay(1);
		flag1<='0';
	END IF;
END IF;
END PROCESS;
LEDrun <= flag1;--分频器的高位作为LED灯闪动信号输出
LEDwait <= flag2;
end Behavioral;